package com.langfeiyes.pattern.composite.v2;


import java.util.ArrayList;
import java.util.List;

/**
 * 叶子菜单，不包含其他子菜单
 * 只需要重写leaf方法
 */
public class MenuLeaf extends Component {
    private String name;
    public MenuLeaf(String name) {
        this.name = name;
    }
    @Override
    public void print() {
        System.out.println("leaf：" + name);
    }

    @Override
    public boolean isLeaf() {
        return true;
    }
}
